package com.pairg.adshelper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class PracticeActivity extends Activity{
	private ListView menu;	
    static final String[] listmenu = new String[]{
    	"Exercicio 01",
    	"Exercicio 02",
    	"Exercicio 03",
    	"Exercicio 04",
    	"Exercicio 05",
    	"Exercicio 06",
    	"Exercicio 07"    	
    };
        
	 public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.practice);
	        
	        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.listitem, listmenu);
	        menu = (ListView)findViewById(R.id.menuListView);
	        menu.setAdapter(adapter);
	        menu.setItemsCanFocus(true);
	        menu.setOnItemClickListener(menuItemListener);
	 }
	 
	 OnItemClickListener menuItemListener = new OnItemClickListener()
	    {
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
					switch (arg2) {
					case 0:
						Intent viewExercice =
	    				new Intent(PracticeActivity.this,ExerciceActivity.class);
						startActivity(viewExercice);
						break;
					default:
						break;
					}
		    	}
	    };
	 public boolean onCreateOptionsMenu(Menu menu) {
	        getMenuInflater().inflate(R.menu.principal, menu);
	        return true;
	 }

}
